import {message ,Button,DatePicker} from 'antd'
import React, { useState, useRef} from 'react'
import { PageHeaderWrapper } from '@ant-design/pro-layout'
import ProTable, { ProColumns, ActionType } from '@ant-design/pro-table'
import { connect, Link } from 'umi'
import {isOfferList, securityOperationType} from '@/utils/constant'
import { getSecurityChangeList } from '../service'
import moment from 'moment';

const TableList = () => {
  const actionRef = useRef();
  const [securityType] = useState(1);
  const [loading, setLoading] = useState(false);


  const columns = [
    {
      title: '姓名',
      dataIndex: 'name',
      hideInSearch: true,
      render: (item, record) => (
        <Link to={`/info/details/${record.oid}`}>{item}</Link>
      ),
    },
    {
      title: '操作类型',
      dataIndex: 'type',
      valueEnum: {
        0: { text: securityOperationType[0].label},
        1: { text: securityOperationType[1].label},
        3: { text: securityOperationType[2].label},
        4: { text: securityOperationType[3].label},
      },
    },
    {
      title: '操作人工号',
      dataIndex: 'operaterCode',
    },
    {
      title: '操作人姓名',
      dataIndex: 'operateName',
    },
    {
      title: '操作时间',
      dataIndex: 'operationTime',
      renderFormItem: (item, props) => {
        return <DatePicker {...props} picker="month" />;
      },
      render: (text)=>{
        return text!=='-'?moment(text).format('YYYY-MM-DD hh:mm:ss'):''
      }
    },
    /*{
      title: '操作',
      dataIndex: 'option',
      hideInSearch: true,
      render: (item, record) => (
        <>
          {/!*{<a onClick={() => updatePlan(record)}>编辑方案</a>}
          {<Divider type="vertical" />}
          {<a onClick={() => setPlanPerson(record)}>配置人员</a>}
          {<Divider type="vertical" />}
          {<a onClick={() => deletePlan(record)}>删除</a>}*!/}
        </>
      ),
    },*/
  ];

  return (
    <PageHeaderWrapper>

      <ProTable
        actionRef={actionRef}
        loading={loading}
        rowKey="changeId"
        request={(params) => getSecurityChangeList(params)}
        columns={columns}
      />

    </PageHeaderWrapper>
  )
};

export default connect(({  }) => ({
}))(TableList)
